<template>
  <div class="jsonStyle">
    <vue-json-editor
      v-model="graphDataList"
      :showBtns="false"
      :mode="'code'"
      lang="zh"
      :expandedOnStart="true"
      @json-change="onJsonChange"
      style="height: 760px"
    />
    <!-- @json-save="onJsonSave" -->
  </div>
</template>

<script>
import vueJsonEditor from "vue-json-editor";
export default {
  data() {
    return {
      graphDataList: null,
    };
  },
  components: { vueJsonEditor },
  watch: {},
  methods: {
    graphDatas(item) {
      this.graphDataList = item;
    },
    // json编辑器内容变化
    onJsonChange(value) {
      console.log("111:", value);
      this.$emit("onJsonSave", value);
    },
    // json编辑器内容保存
    // onJsonSave(value) {
    //   console.log(value, 1111);
    //   this.$emit("onJsonSave", value);
    //   // this.$message({
    //   //   message: "保存数据成功",
    //   //   type: "success",
    //   //   duration: 2000,
    //   // });
    // },
  },
  created() {},
  mounted() {},
};
</script>

<style  lang="less" scoped>
.jsonStyle {
  margin: 20px;
  // height: 300px;
}
::v-deep .jsoneditor-vue {
  height: 100%;
  z-index: 100;
}
</style>